Skip to content

tools: adding slackbot for PR notifications#16750

Merged
mattklein123 merged 16 commits intoenvoyproxy:mainfrom
alyssawilk:slackbot
Jun 2, 2021
Merged

tools: adding slackbot for PR notifications#16750
mattklein123 merged 16 commits intoenvoyproxy:mainfrom
alyssawilk:slackbot

Conversation

@alyssawilk
Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk commented Jun 1, 2021

We've been having PRs slipping through the cracks because repokitten assigns API reviewers and maintainer-on-call sees PRs as assigned and doesn't necessarily tag a maintainer for review.

Also adding hopefully helpful reminders for PRs which get stale. These will be less useful if folks don't use the waiting tag when waiting for response so will kick off a discussion thread on #maintainers about that

Risk Level: n/a
Testing: manual
Docs Changes: n/a
Release Notes: n/a
co-authored-by: mattklein123

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@repokitteh-read-only repokitteh-read-only bot added the deps Approval required for changes to Envoy's external dependencies label Jun 1, 2021
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/dependency-shepherds: Your approval is needed for changes made to (bazel/.*repos.*\.bzl)|(bazel/dependency_imports\.bzl)|(api/bazel/.*\.bzl)|(.*/requirements\.txt)|(.*\.patch).

🐱

Caused by: #16750 was opened by alyssawilk.

see: more, trace.

Copy link
Copy Markdown
Contributor Author

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, I thought I ran format_pre locally before I sent this out. looking


# If the PR hasn't been updated recently, don't nag.
# We can revisit this time, and always warn.
now = datetime.datetime.now()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If folks are likely to use this as their daily reminder, maybe we should warn for anything assigned? it is nice to have one place to look through

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I'm just going to update this one now.

Thing I don't understand, how the datetime returned by github doesn't come with a time zone - I did not expect to have to do the shifting manually but the timestamps were off unless I did. If someone with better python skills has ideas lmk

@@ -0,0 +1,192 @@
# Script for collecting PRs in need of review, and informing maintainers via
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's up to you, but my preference is to just run this as a daily GH action cron. It looks like it should be pretty easy to use an action with code that exists in the repo: https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions?learn=getting_started#referencing-an-action-in-the-same-repository-where-a-workflow-file-uses-the-action.

Do you want to do this as a follow up or try to get this working now? I can help offline with credentials, etc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think follow-up if that's OK

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure that's fine. Per offline convo I will help set up a GH action template that we can move this to in parallel.

Copy link
Copy Markdown
Member

@phlax phlax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @alyssawilk ive done a quick first review

its not clear to me how this code is triggered - im happy to review/test further once i understand better

waiting_prs.append("PR %s' is tagged as waiting" % (pr_title))
waiting = True
continue
if (waiting):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary parentheses

stalled_prs = ""

# Snag all PRs, including drafts
for pr_info in repo.get_pulls("open"):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this loop is quite long and hard to follow - is it possible to break into some functions - it would make it more expressive and allow a load of dedenting



from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these need to be at the top - but i guess ci has told you that already

@@ -0,0 +1,7 @@
#!/bin/bash

. tools/shell_utils.sh
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im very much trying to get rid of this - can we use bazel for dependencies?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have examples of scripts that run that way? my tooling skills are pretty weak so I just copied this from one of the other scrips

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can follow up after and shift this to bazel if thats helpful

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately we are going to run this as a GH action. I think it will be much easier if we just stick with raw pip for this tool since I think it will be trivial to get running in GHA. So I think the end result here is we will lose the SH file and just keep the requirements.txt file. I will follow up once I do a template for GHA.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are using gh actions to trigger this we probs want to use something like this i think https://github.com/marketplace/actions/pip-installer

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Copy Markdown
Contributor Author

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, CI failure is dependabot. I'm going to fix in the next push becasue I'm not sure if the way phlax is suggesting I rework deps will change

@@ -0,0 +1,7 @@
#!/bin/bash

. tools/shell_utils.sh
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have examples of scripts that run that way? my tooling skills are pretty weak so I just copied this from one of the other scrips

@@ -0,0 +1,192 @@
# Script for collecting PRs in need of review, and informing maintainers via
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think follow-up if that's OK

pass # Python 3

maintainers = {
Maintainers = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry to be annoying - the convention for constants in python is all caps - ie MAINTAINERS

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha, not annoying at all. I thought that request was kinda weird because I read it as Maintainers - makes much more sense w.r.t. python style now I'm not misreading it!

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@mattklein123
Copy link
Copy Markdown
Member

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Copy Markdown
Contributor Author

Any other requests for the scripts?

If not should I move them to .github/actions/pr_notifier/ ?

@mattklein123
Copy link
Copy Markdown
Member

@alyssawilk I would say let's move it and wire it up. We can launch and iterate. I will help you with the secret stuff offline.

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@@ -0,0 +1,22 @@
on:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend leaving the manual trigger option that I had in the example. This will allow you to manually trigger it from the UI to test it and also if for whatever reason the run fails and we want to run it.

run: |
python -m pip install --upgrade pip
pip install -r ./.github/actions/pr_notifier/requirements.txt
- name: Display Python version
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: update to better text

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
run: |
python -m pip install --upgrade pip
pip install -r ./.github/actions/pr_notifier/requirements.txt
- name: Display Python version
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need to add the env var for the token secret here.

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
mattklein123
mattklein123 previously approved these changes Jun 2, 2021
Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!!! I would just force merge it and you can test it manually.

phlax
phlax previously approved these changes Jun 2, 2021
@phlax
Copy link
Copy Markdown
Member

phlax commented Jun 2, 2021

@alyssawilk this still needs the dependabot setup i think

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk alyssawilk dismissed stale reviews from phlax and mattklein123 via d57640e June 2, 2021 17:05
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
mattklein123
mattklein123 previously approved these changes Jun 2, 2021
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@mattklein123 mattklein123 merged commit 6a4b0d5 into envoyproxy:main Jun 2, 2021
leyao-daily pushed a commit to leyao-daily/envoy that referenced this pull request Sep 30, 2021
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk alyssawilk deleted the slackbot branch August 4, 2022 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deps Approval required for changes to Envoy's external dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants